/*

Boost Software License - Version 1.0 - August 17th, 2003

Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:

The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

*/
module derelict.assimp.types;


// assimp.h
extern (C) nothrow alias void function(const(char)*, char*) aiLogStreamCallback;

struct aiLogStream
{
    aiLogStreamCallback callback;
    char* user;
}


// aiPostProcess.h
enum aiPostProcessSteps : uint
{
    CalcTangentSpace = 0x1,
    JoinIdenticalVertices = 0x2,
    MakeLeftHanded = 0x4,
    Triangulate = 0x8,
    RemoveComponent = 0x10,
    GenNormals = 0x20,
    GenSmoothNormals = 0x40,
    SplitLargeMeshes = 0x80,
    PreTransformVertices = 0x100,
    LimitBoneWeights = 0x200,
    ValidateDataStructure = 0x400,
    ImproveCacheLocality = 0x800,
    RemoveRedundantMaterials = 0x1000,
    FixInfacingNormals = 0x2000,
    SortByPType = 0x8000,
    FindDegenerates = 0x10000,
    FindInvalidData = 0x20000,
    GenUVCoords = 0x40000,
    TransformUVCoords = 0x80000,
    FindInstances = 0x100000,
    OptimizeMeshes = 0x200000,
    OptimizeGraph = 0x400000,
    FlipUVs = 0x800000,
    FlipWindingOrder = 0x1000000
}

// aiAnim.h
struct aiVectorKey
{
    double mTime;
    aiVector3D mValue;
}

struct aiQuatKey
{
    double mTime;
    aiQuaternion mValue;
}

struct aiMeshKey
{
    double mTime;
    uint mValue;
}

enum aiAnimBehaviour : uint
{
    DEFAULT = 0x0,
    CONSTANT = 0x1,
    LINEAR = 0x2,
    REPEAT = 0x3,
}

struct aiNodeAnim
{
    aiString mNodeName;
    uint mNumPositionKeys;
    aiVectorKey* mPositionKEys;
    uint mNumRotationKeys;
    aiQuatKey* mRotationKeys;
    uint mNumScalingKeys;
    aiVectorKey* mScalingKeys;
    aiAnimBehaviour mPreState;
    aiAnimBehaviour mPostState;
}

struct aiMeshAnim
{
    aiString mName;
    uint mNumKeys;
    aiMeshKey* mKeys;
}

struct aiAnimation
{
    aiString mName;
    double mDuration;
    double mTicksPerSecond;
    uint mNumChannels;
    aiNodeAnim** mChannels;
    uint mNumMeshChannels;
    aiMeshAnim** mMeshChannels;
}


// aiMaterial.h
const uint AI_MAX_NUMBER_OF_COLOR_SETS = 0x8;
const uint AI_MAX_NUMBER_OF_TEXTURECOORDS = 0x8;

enum aiTextureOp : uint
{
    Multiply = 0x0,
    Add = 0x1,
    Subtract = 0x2,
    Divide = 0x3,
    SmoothAdd = 0x4,
    SignedAdd = 0x5,
}

enum aiTextureMapMode : uint
{
    Wrap = 0x0,
    Clamp = 0x1,
    Decal = 0x3,
    Mirror = 0x2,
}

enum aiTextureMapping : uint
{
    UV = 0x0,
    SPHERE = 0x1,
    CYLINDER = 0x2,
    BOX = 0x3,
    PLANE = 0x4,
    OTHER = 0x5,
}

enum aiTextureType : uint
{
    NONE = 0x0,
    DIFFUSE = 0x1,
    SPECULAR = 0x2,
    AMBIENT = 0x3,
    EMISSIVE = 0x4,
    HEIGHT = 0x5,
    NORMALS = 0x6,
    SHININESS = 0x7,
    OPACITY = 0x8,
    DISPLACEMENT = 0x9,
    LIGHTMAP = 0xA,
    REFLECTION = 0xB,
    UNKNOWN = 0xC,
}

enum aiShadingMode : uint
{
    Flat = 0x1,
    Gouraud = 0x2,
    Phong = 0x3,
    Blinn = 0x4,
    Toon = 0x5,
    OrenNayar = 0x6,
    Minnaert = 0x7,
    CookTorrance = 0x8,
    NoShading = 0x9,
    Fresnel = 0xA,
}

enum aiBlendMode : uint
{
    Default = 0x0,
    Additive = 0x1,
}

struct aiUVTransform
{
    aiVector2D mTranslation;
    aiVector3D mScaling;
    float mRotation;
}

enum aiPropertyTypeInfo : uint
{
    Float = 0x1,
    String = 0x3,
    Integer = 0x4,
    Buffer = 0x5,
}

struct aiMaterialProperty
{
    aiString mKey;
    uint mSemantic;
    uint mIndex;
    uint mDataLength;
    aiPropertyTypeInfo mType;
    char* mData;
}

struct aiMaterial
{
    aiMaterialProperty** mProperties;
    uint mNumProperties;
    uint mNumAllocated;
}


// aiTexture.h
struct aiTexel
{
    ubyte b, g, r, a;
}

struct aiTexture
{
    uint mWidth;
    uint mHeight;
    char achFormatHint[4];
    aiTexel* pcData;
}


// aiLight.h
enum aiLightSourceType : uint
{
    UNDEFINED = 0x0,
    DIRECTIONAL = 0x1,
    POINT = 0x2,
    SPOT = 0x3,
}

struct aiLight
{
    aiString mName;
    aiLightSourceType mType;
    aiVector3D mPosition;
    aiVector3D mDirection;
    float mAttenuationConstant;
    float mAttenuationLinear;
    float mAttentuationQuadratic;
    aiColor3D mColorDiffuse;
    aiColor3D mColorSpecular;
    aiColor3D mColorAmbient;
    float mAngleInnerCone;
    float mAngleOuterCone;
}


// aiCamera.h
struct aiCamera
{
    aiString mName;
    aiVector3D mPosition;
    aiVector3D mUp;
    aiVector3D mLookAt;
    float mHorizontalFOV;
    float mClipPlaneNear;
    float mClipPlaneFar;
    float mAspect;
}


// aiFileIO.h
extern (C) nothrow
{
    alias size_t function(aiFile*, const char*, size_t, size_t) aiFileWriteProc;
    alias size_t function(aiFile*, char*, size_t, size_t) aiFileReadProc;
    alias size_t function(aiFile*) aiFileTellProc;
    alias void function(aiFile*) aiFileFlushProc;
    alias aiReturn function(aiFile*, size_t, aiOrigin) aiFileSeekProc;

    alias aiFile* function(aiFileIO*, const char*, const char*) aiFileOpenProc;
    alias void function(aiFileIO*, aiFile*) aiFileCloseProc;

    alias char* aiUserData;
}

struct aiFileIO
{
    aiFileOpenProc OpenProc;
    aiFileCloseProc CloseProc;
    aiUserData UserData;
}

struct aiFile
{
    aiFileReadProc ReadProc;
    aiFileWriteProc WriteProc;
    aiFileTellProc TellProc;
    aiFileTellProc FileSizeProc;
    aiFileSeekProc SeekProc;
    aiFileFlushProc FlushProc;
    aiUserData UserData;
}


// aiVector2D.h
struct aiVector2D
{
    float x, y;
}


// aiVector3D.h
struct aiVector3D
{
    float x, y, z;
}


// aiQuaternion.h
struct aiQuaternion
{
    float w, x, y, z;
}


// aiMatrix3x3.h
struct aiMatrix3x3
{
    float a1, a2, a3;
    float b1, b2, b3;
    float c1, c2, c3;
}


// aiMatrix4x4.h
struct aiMatrix4x4
{
    float a1, a2, a3, a4;
    float b1, b2, b3, b4;
    float c1, c2, c3, c4;
    float d1, d2, d3, d4;
}


// aiColor4D.h
struct aiColor4D
{
    float r, g, b, a;
}


// aiMesh.h
struct aiFace
{
    uint mNumIndices;
    uint* mIndices;
}

struct aiVertexWeight
{
    uint mVertexId;
    float mWeight;
}

struct aiBone
{
    aiString mName;
    uint mnumWeights;
    aiVertexWeight* mWeights;
    aiMatrix4x4 mOffsetMatrix;
}

enum aiPrimitiveType : uint
{
    POINT = 0x1,
    LINE = 0x2,
    TRIANGLE = 0x4,
    POLYGON = 0x8,
}

struct aiAnimMesh
{
    aiVector3D* mVertices;
    aiVector3D* mNormals;
    aiVector3D* mTangents;
    aiVector3D* mBitangents;
    aiColor4D* mColor[AI_MAX_NUMBER_OF_COLOR_SETS];
    aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
    uint mNumVertices;
}

struct aiMesh
{
    uint mPrimitiveTypes;
    uint mNumVertices;
    uint mNumFaces;
    aiVector3D* mVertices;
    aiVector3D* mNormals;
    aiVector3D* mTangents;
    aiVector3D* mBitangents;
    aiColor4D * mColors[AI_MAX_NUMBER_OF_COLOR_SETS];
    aiVector3D* mTextureCoords[AI_MAX_NUMBER_OF_TEXTURECOORDS];
    uint mNumUVComponents[AI_MAX_NUMBER_OF_TEXTURECOORDS];
    aiFace* mFaces;
    uint mNumBones;
    aiBone** mBones;
    uint mMaterialIndex;
    aiString mName;
    uint mNumAnimMeshes;
    aiAnimMesh** mAnimMeshes;
}


// aiScene.h
struct aiNode
{
    aiString mName;
    aiMatrix4x4 mTransformation;
    aiNode* mParent;
    uint mNumChildren;
    aiNode** mChildren;
    uint mNumMeshes;
    uint* mMeshes;
}

struct aiScene
{
    uint mFlags;
    aiNode* mRootNode;
    uint mNumMeshes;
    aiMesh** mMeshes;
    uint mNumMaterials;
    aiMaterial** mMaterials;
    uint mNumAnimations;
    aiAnimation** mAnimations;
    uint mNumTextures;
    aiTexture** mTextures;
    uint mNumLights;
    aiLight** mLights;
    uint mNumCameras;
    aiCamera** mCameras;
}


// aiTypes.h
struct aiString
{
    size_t length;
    char data[MAXLEN];
}

enum aiDefaultLogStream : int
{
    FILE = 0x1,
    STDOUT = 0x2,
    STDERR = 0x4,
    DEBUGGER = 0x8,
}

enum aiReturn : int
{
    SUCCESS = 0x0,
    FAILURE = -0x1,
    OUTOFMEMORY = -0x3,
}

struct aiColor3D
{
    float r, g, b;
}

enum aiOrigin : uint
{
    SET = 0x0,
    CUR = 0x1,
    END = 0x2,
}

struct aiMemoryInfo
{
    uint textures;
    uint materials;
    uint meshes;
    uint nodes;
    uint animations;
    uint cameras;
    uint lights;
    uint total;
}

const size_t MAXLEN = 1024;

alias int aiBool;

enum AI_FALSE = 0,
     AI_TRUE = 1;


// version.h
enum ASSIMP_CFLAGS_SHARED = 0x1,
     ASSIMP_CFLAGS_STLPORT = 0x2,
     ASSIMP_CFLAGS_DEBUG = 0x4,
     ASSIMP_CFLAGS_NOBOOST = 0x8,
     ASSIMP_CFLAGS_SINGLETHREADED = 0x10;
